home *** CD-ROM | disk | FTP | other *** search
- package sun.tools.zip;
-
- import java.io.IOException;
- import java.io.InputStream;
-
- public class ZipReader implements ZipConstants {
- // $FF: renamed from: is java.io.InputStream
- private InputStream field_0;
- // $FF: renamed from: ze sun.tools.zip.ZipEntry
- private ZipEntry field_1;
- private ZipReaderInputStream zis;
- private byte[] lochdr = new byte[30];
-
- public ZipReader(InputStream var1) {
- this.field_0 = var1;
- }
-
- public boolean nextEntry() throws ZipFormatException, IOException {
- if (this.field_0 == null) {
- return false;
- } else {
- if (this.zis != null) {
- while(this.zis.count > 0) {
- this.zis.skip((long)this.zis.count);
- }
- }
-
- this.readFully(this.lochdr, 0, 4);
- if (!ZipFile.checkSig(this.lochdr, ZipConstants.LOCSIG)) {
- if (ZipFile.checkSig(this.lochdr, ZipConstants.CENSIG)) {
- return false;
- } else {
- this.field_0 = null;
- throw new ZipFormatException("Invalid LOC header signature");
- }
- } else {
- this.readFully(this.lochdr, 4, 26);
- if (ZipFile.getWord(this.lochdr, 8) != 0) {
- throw new ZipFormatException("Compressed entries not supported");
- } else if ((ZipFile.getWord(this.lochdr, 6) & 1) == 1) {
- throw new ZipFormatException("Encrypted entries not supported");
- } else {
- byte[] var1 = new byte[ZipFile.getWord(this.lochdr, 26)];
- this.readFully(var1, 0, var1.length);
- String var2 = new String(var1, 0, 0, var1.length);
- this.field_1 = new ZipEntry(var2);
- this.field_1.length = ZipFile.getLong(this.lochdr, 22);
- this.field_1.mtime = ZipFile.getLong(this.lochdr, 12);
- if (!this.skip((long)ZipFile.getWord(this.lochdr, 28))) {
- throw new ZipFormatException("Unexpected EOF");
- } else {
- this.zis = new ZipReaderInputStream(this.field_0, this.field_1);
- return true;
- }
- }
- }
- }
- }
-
- public ZipEntry getEntry() {
- return this.field_1;
- }
-
- public InputStream getInputStream() {
- return this.zis;
- }
-
- private boolean readFully(byte[] var1, int var2, int var3) throws IOException {
- while(var3 > 0) {
- int var4 = this.field_0.read(var1, var2, var3);
- if (var4 == -1) {
- return false;
- }
-
- var2 += var4;
- var3 -= var4;
- }
-
- return true;
- }
-
- private boolean skip(long var1) throws IOException {
- return this.field_0.skip(var1) == var1;
- }
- }
-